<template>
	<view>
		<!-- 头部 -->
		<view class="header">
			<!-- 用户信息类 -->
			<view class="header-message" v-if="userInfo">
				<image class="HeadPortraits" src="../../../static/mine/HeadPortraits.png" mode=""></image>
				<view class="header-username">
					<view>
						<text>{{userInfo.nickName}}</text>
					</view>
					<view class="user-Authentication">
						<view>
							<text>理财达人</text>
						</view>
						<view>
							<text>未实名 ></text>
						</view>
					</view>
				</view>
				<view class="SignIn">
					<view class="SignIn-message">
						<image class="SignIn-image" src="../../../static/mine/custom.png" mode=""></image>
						<text class="SignIn-text">签到</text>
					</view>
				</view>
			</view>

			<!-- 用户没登录 -->

			<view class="header-message" v-else>
				<image class="HeadPortraits" src="../../../static/mine/HeadPortraits.png" mode=""></image>
				<view class="header-username">
					<view>
						<text>Hi,祥瑞用户</text>
					</view>
					<view class="user-Authentication">
						<view>
							<text>理财达人</text>
						</view>
						<view>
							<text>未实名 ></text>
						</view>
					</view>
				</view>
				<view class="SignIn">
					<view class="SignIn-message">
						<image class="SignIn-image" src="../../../static/mine/custom.png" mode=""></image>
						<text class="SignIn-text">签到</text>
					</view>
				</view>
			</view>

			<!--  -->
			<!-- 积分 金额  -->
			<view class="Amount">
				<view class="Amount-view">
					<text class="Amount-view-num">0</text>
					<text class="Amount-view-name">我的积分</text>
				</view>
				<view class="Amount-view" @click="bills">
					<text   v-if="bill"  class="Amount-view-num">{{bill.length}}</text>
					<text v-else class="Amount-view-num">0</text>
					<text class="Amount-view-name">我的账单</text>
				</view>
				<view class="Amount-view">
					<text class="Amount-view-num">0</text>
					<text class="Amount-view-name">权益包</text>
				</view>
				<view class="Amount-view">
					<text class="Amount-view-num">0</text>
					<text class="Amount-view-name">银行卡</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: null, //用户信息
				bill:null, //账单
			}
		},
		created() {
			this.userInfo = getApp().globalData.userInfo;

			// 我的账单
			this.selectNewOrder()
		},
		methods: {
			// 我的账单
			async selectNewOrder() {
				const res = await this.$request({
					url: "/member/selectNewOrder",
					method: "POST",
					data:{
						
					}
				})
				console.log(res,'账单')
				if(res.code==200){
					this.bill =res.data
				}
			},
			// 跳转到账单
			bills(){
				uni.navigateTo({
					url:"/pages/bill/bill?bill="+JSON.stringify(this.bill)
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	// 引入局部的scss文件
	@import './UserProfile.scss'
</style>
